Block save in readonly mode#407
Conversation
|
|
||
| @Override | ||
| protected void execStore() { | ||
| BEANS.get(ContactsHelper.class).failIfReadOnly(); |
There was a problem hiding this comment.
Is it necessary to show an exception? Maybe just doing nothing would be enough. This would also make it unnecessary to rename the save button to "Close". That the save button does not actually store anything should be obvious because of the label at the top right. We could also simply disable the save button and set askIfSaveNeeded to false.
Also, considering that the contacts app should be a public example of best practices, maybe apply this check in the service, not in the form? If the contacts app was ever ported to Scout JS, the check would have to be in the service anyway.
There was a problem hiding this comment.
Ok, I removed the code that changed the buttons.
I added backend validation using permissions.
Now you get a permission denied message when trying to save in readOnly mode.
This implementation also adds an access control example which might be helpful?
Do you think we should disable the save buttons and change askIfSaveNeeded as well?
129aaaf to
f666a2e
Compare
Previously it was possible to save when pressing cancel. 461788
f666a2e to
3cfd3ce
Compare
Previously it was possible to save when pressing cancel.
461788